# server/src/knowledge/provider.py
# 知识库接口
from abc import ABC, abstractmethod
from typing import List, Dict, Optional

class KnowledgeProvider(ABC):
    @abstractmethod
    async def add_document(self, file_content: bytes, filename: str, metadata: dict) -> int:
        """添加文档到知识库"""
        pass
    
    @abstractmethod
    async def search(self, query: str, top_k: int=3) -> List[str]:
        """语义搜索文档"""
        pass
    
    @abstractmethod
    async def delete_document(self, doc_id: int) -> bool:
        """软删除文档"""
        pass
    
    @abstractmethod
    async def list_documents(self, page: int=1, page_size: int=10) -> List[dict]:
        """列出所有文档"""
        pass